import * as React from "react";
import { Input, Button } from "antd";

export interface SearchConditionProps {
  onSubmit: (date: any) => any;
}

export interface SearchConditionState {
  devVal: string;
}

class SearchCondition extends React.Component<
  SearchConditionProps,
  SearchConditionState
> {
  state = { devVal: "" };
  getCondition() {
    let { devVal } = this.state;
    let queryData = {
      devVal,
    };
    this.props.onSubmit(queryData);
  }
  render() {
    return (
      <div className="bare_body" style={{ padding: 16, paddingTop: 0 }}>
        <span style={{ paddingLeft: 26 }}>设备名称：</span>
        <div className="changeType_btn d_inlineFlex">
          <Input
            className="input"
            placeholder="请输入设备名称："
            value={this.state.devVal}
            onChange={(e) => {
              this.setState({ devVal: e.target.value });
            }}
          />
        </div>
        <Button
          type="primary"
          className="l_distance"
          onClick={() => {
            this.getCondition();
          }}
          style={{ marginLeft: 26 }}
        >
          查询
        </Button>
      </div>
    );
  }
}

export default SearchCondition;
